package com.etime.shycourse.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.etime.shycourse.config.PageMessage;
import com.etime.shycourse.dto.LiveRecordDto;
import com.etime.shycourse.services.interfaces.LiveRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author wb
 * @since 2022-04-01
 */
@Api(tags = "后台-直播记录")
@RestController
@RequestMapping("/sys/liverecord")
public class LiverecordController {
    @Autowired
    private LiveRecordService service;

    @ApiOperation("直播记录日志 分页")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "第几页"),
            @ApiImplicitParam(name = "pageSize", value = "每页多少行"),
    })
    @GetMapping("/page")
    public PageMessage<LiveRecordDto> selectLiveRecordPage(LiveRecordDto liveRecordDto, Long pageNum, Long pageSize) {
        PageMessage<LiveRecordDto> msg = new PageMessage<>();
        Page<LiveRecordDto> data = service.selectLiveRecordDtoPage(liveRecordDto, pageNum, pageSize);
        if (data.getSize() > 0) {
            msg.setCode(1);
            msg.setPagedata(data);
        } else {
            msg.setCode(0);
            msg.setMsg("没有查询到数据");
        }
        return msg;
    }
}

